Skip to content

fix(ci): workflow path 跟随 i18n URL 段化(修 sync-uuid 失败 + IndexNow 双语推送)#331

Merged
longsizhuo merged 2 commits intomainfrom
fix/ci-i18n-paths
May 6, 2026
Merged

fix(ci): workflow path 跟随 i18n URL 段化(修 sync-uuid 失败 + IndexNow 双语推送)#331
longsizhuo merged 2 commits intomainfrom
fix/ci-i18n-paths

Conversation

@longsizhuo
Copy link
Copy Markdown
Member

问题

i18n PR #330 merge 后两个 CI 问题:

1. `sync-uuid` workflow 在 main 上 fail(hard error)

Run #25441855788 失败:

```
fatal: pathspec 'app/docs/**/*.md' did not match any files
2026/05/06 14:38:15 Process exited with status 128
```

backfill 脚本本身已经成功生成 153 条 contributor entries(都是 content/docs/...
路径,证明改造对了),但最后这一步:

```yaml
git add 'app/docs//*.md' 'app/docs//*.mdx' generated/doc-contributors.json
```

`app/docs/` 已经搬到 `content/docs/` 整个删除了,pathspec 不匹配 → git 退
出 128 → workflow fail。贡献者署名生命线挂了

2. `deploy.yml` 的 IndexNow 推送 URL 没加 locale 前缀

i18n 段化后 docs URL 都是 `/zh/docs/...` 或 `/en/docs/...`。当前推送的是
`/docs/...`(不带 locale),Bing/Yandex 收到后会:

  • 命中 next-intl 308 redirect,IndexNow 当作"老 URL"处理
  • 新的 `/zh/docs/...` `/en/docs/...` 永远不会被主动通知

`sync-uuid.yml`

  • `paths` trigger `app/docs/` → `content/docs/`
  • 自动 commit 阶段 `git diff / git add` 路径同步改

`content-check.yml`

  • `paths` trigger 同步改

`deploy.yml` (IndexNow)

  • 删掉旧 `app/docs/(.*)/page.tsx` 提取分支(不再有 page.tsx-as-content 的形态)
  • `content/docs/(.*).mdx` 提 base slug 时剥离 `.en` / `.zh` 后缀,拿
    canonical slug
  • 每篇文档推送 zh + en 两条 URL(i18n 段化后这是两个独立 URL)
  • fallback 首页 URL 也改成 `/zh` + `/en` 双语

影响

  • `sync-uuid` 修好后下次跑会自动 commit 新生成的 `generated/doc-contributors.json`
    (含 153 条 i18n 改造后的最新署名快照)。本 PR 故意带这个 JSON
    改动,留给 workflow 自己 commit,避免人工出错
  • IndexNow 修好后下次任何 docs commit 都会双语通知 Bing/Yandex,加速新
    URL 索引

Test plan

  • PR merge → `sync-uuid` workflow 不再 fail,自动 commit doc-contributors.json
  • `deploy.yml` IndexNow 步骤推送的 URL 列表都带 `/zh` 或 `/en` 前缀
  • 一周内 Bing Webmaster Tools 看到新 URL 收录上升

i18n PR (#330) merge 后,sync-uuid workflow 在 main 上 fail:
git add 'app/docs/**/*.md' 'app/docs/**/*.mdx' 因为 app/docs 已经
不存在,pathspec 不匹配任何文件,git 退出码 128 → workflow 失败。
backfill 脚本本身 OK(已成功生成 JSON),失败在最后 commit 那一步。

修:

1. sync-uuid.yml
   - paths trigger: app/docs/** → content/docs/**
   - git diff / git add 路径同步改 content/docs

2. content-check.yml
   - paths trigger: app/docs/** → content/docs/**

3. deploy.yml (IndexNow 推送)
   - 删掉旧 app/docs/(.*)/page.tsx 提取分支(不再有 page.tsx-as-content)
   - content/docs/(.*).mdx 提 base slug 时剥离 locale 后缀(.en/.zh),
     拿到 canonical slug
   - 每篇文档推送 zh + en 两条 URL(/zh/docs/<slug> + /en/docs/<slug>),
     i18n 段化后这是两个独立 URL,IndexNow 要分别通知
   - fallback URL 也改成双语 ($SITE_ORIGIN/zh + $SITE_ORIGIN/en)

注:generated/doc-contributors.json 留给 sync-uuid workflow 修好后
下次跑自己 commit,不进本 PR。
Copilot AI review requested due to automatic review settings May 6, 2026 14:45
@vercel
Copy link
Copy Markdown

vercel Bot commented May 6, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
involutionhell-github-io Ready Ready Preview, Comment May 6, 2026 3:25pm
website-preview Ready Ready Preview, Comment May 6, 2026 3:25pm

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes CI workflows impacted by the docs i18n refactor (moving MDX content to content/docs/ and introducing locale-prefixed docs URLs), restoring the contributor backfill workflow and updating IndexNow submissions to target the new /zh/... and /en/... routes.

Changes:

  • Update sync-uuid.yml and content-check.yml path filters and auto-commit pathspecs from app/docs/** to content/docs/**.
  • Update deploy.yml IndexNow URL extraction to derive slugs from content/docs/**/*.md(x) and submit both /zh/docs/... and /en/docs/... URLs (plus /zh and /en fallback home URLs).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
.github/workflows/sync-uuid.yml Fixes workflow trigger + auto-commit paths after docs content moved to content/docs/.
.github/workflows/deploy.yml Updates IndexNow URL generation to locale-prefixed docs URLs and dual-language submission.
.github/workflows/content-check.yml Aligns PR path triggers with content/docs/ after the docs content move.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 88 to 99
while IFS= read -r f; do
[ -z "$f" ] && continue
if [[ "$f" =~ ^content/docs/(.*)\.(md|mdx)$ ]]; then
slug="${BASH_REMATCH[1]}"
# 剥离 locale 后缀(.en / .zh),拿到 canonical base slug
slug="${slug%.en}"
slug="${slug%.zh}"
# index.mdx 对应目录本身的 URL(fumadocs 约定)
slug="${slug%/index}"
URLS+=("$SITE_ORIGIN/docs/$slug")
URLS+=("$SITE_ORIGIN/zh/docs/$slug")
URLS+=("$SITE_ORIGIN/en/docs/$slug")
fi
CR (Copilot) 指出 #331 的 deploy.yml 直接拿文件路径当 slug,但
lib/source.ts 的 transformer 把 career/interview-prep/leetcode/ 下
含中文的文件名拼音化(convertSlugToPinyin):

  文件:content/docs/career/interview-prep/leetcode/142.环形链表II_translated.md
  实际路由:/<locale>/docs/career/interview-prep/leetcode/142-huan-xing-lian-biao-iitranslated
  我之前推的:/<locale>/docs/career/interview-prep/leetcode/142.环形链表II_translated  ← 404

修:在 deploy.yml 的 IndexNow URL 提取里复用 generated/leetcode-slug-map.json
(prebuild 时由 scripts/generate-leetcode-slug-map.mts 用同一份算法生成),
对 leetcode 子树的 slug 做 stem → 拼音 映射后再推送。

非 leetcode 子树的 slug 不受影响(它们的文件名都是 ASCII,路由按 file
path 直出,不需要映射)。
@longsizhuo longsizhuo merged commit 8c0fc06 into main May 6, 2026
6 of 7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants